#include <iostream>
using namespace std;

typedef long long ll;
int N = 1e5+10;
    
//    5
// 4 2 4 5 1

// 5
// 4 1 4 5 2
// 1 4 4 5 2
// 1 2 4 4 5

//选择排序， O(n^2),两层循环，
//每次选择最小（大）的，与开头的交换
void select_sort(ll a[], int n){
	
    for (int i = 0; i < n-1; ++i){
        int rcd = i;
        for (int j = rcd+1; j < n; ++j){
            if(a[rcd] > a[j]) rcd = j;
        }
        
        if (i != rcd){
        	ll tmp = a[rcd];
        	a[rcd] = a[i];
        	a[i] = tmp;
		}
    }
    
}

void bubble_sort(ll a[], int n){
    for (int i=n-1; i > 0; --i){
        for (int j = 0; j < i; j++){
            if (a[j] > a[j+1])
            {
                swap(a[j], a[j+1]);
                /* code */
            }
            
        }
    }
}

void insertion_sort(int arr[], int len) {
  for (int i = 1; i < len; ++i) {
    int key = arr[i]; 
    int j = i - 1;
    while (j >= 0 && arr[j] > key) {
      arr[j + 1] = arr[j];
      j--;
    }
    arr[j + 1] = key;
  }
}

void insert_sort(ll a[], int n){
    for (int i = 1; i < n; i++){
        int j = i-1;
        int key = a[i];
        while (j >=  0 && key < a[j]){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = key;
    }
}

void Binsert_sort(ll a[], int n){
    int i, j, l, r, mid, key;
    for (i = 1; i < n; ++i){
        j = i-1;
        key = a[i];
        l = 0;
        r = i-1;

        while (l < r)
        {
            mid = (l+r)/2;
            if (a[mid] >= key) r = mid;
            else l = mid+1;
        }

        if (a[l] < key) l+=1;
        
        for (j = i-1; j >= l; --j){
            a[j+1] = a[j];
        }

        a[l] = key;
    }
}

void Binsert_sort2(ll a[], int n){
    int i, j, l, r, mid, key;
    for (i = 1; i < n; ++i){
        key = a[i];
        l = 0;
        r = i-1;
        while (l <= r)
        {
            mid = (l+r)/2;
            if (a[mid] > key) r = mid-1;
            else l = mid+1;
        }
        for (j = i-1; j >= r+1; --j){
            a[j+1] = a[j];
        }

        a[r+1] = key;
    }
}



int main(){
    int n; 
    cin >> n;
    ll a[N];

    for (int i = 0; i < n; ++i){
    	cin >> a[i];
    }
    // select_sort(a,n);

    // bubble_sort(a, n);

    // insert_sort(a,n);

    Binsert_sort2(a,n);


//    
    for (int i = 0; i < n; ++i)
        printf("%d ",a[i]);
        
    return 0;
}